package com.candy.service.impl;

import com.candy.dao.AccountDao;
import com.candy.dao.impl.AccountDaoImpl;
import com.candy.service.AccountService;

import java.util.Date;

public class AccountServiceImpl implements AccountService {
//成员变量
    private  String name;
    private Integer age;
    private Date date;

    private AccountDao accountDao;
//无参构造
    public AccountServiceImpl() {
    }
//带有参数的构造函数，和我们使用构造函数进行注入值时指定的构造函数参数相同
    public AccountServiceImpl(String name, Integer age, Date date) {
        this.name = name;
        this.age = age;
        this.date = date;
    }




    @Override
    public void saveAccount() {
        accountDao.save();
    }

    public AccountDao getAccountDao() {
        return accountDao;
    }

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }


    public void initMethod(){
        System.out.println("对象初始化了。。。。。。");
    }


    public void endMethod(){
        System.out.println("对象被销毁了");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "AccountServiceImpl{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", date=" + date +
                ", accountDao=" + accountDao +
                '}';
    }
}
